package com.jielin.handling.entity.vo;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jielin.handling.bean.base.BaseSearch;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author chenzhang
 * @date 2019/8/14 - 14:18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CaseVo extends BaseSearch {
    private String id;
    private String caseName;
    private String caseCode;
    private String caseType;
    private Integer suspectCount;
    private String civilianPolice;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date  acceptTime;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date startDate;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date endDate;
    private int state;
    private String unitCode;
    private String caseNameAndCode;

    @Override
    public void setQueryCondition(JSONObject queryCondition) {
        this.state=queryCondition.getIntValue("state");
        this.unitCode = queryCondition.getString("unitCode");
        this.caseName = queryCondition.getString("caseName");
        this.caseCode = queryCondition.getString("caseCode");
        this.acceptTime = queryCondition.getDate("acceptTime");
        this.startDate = queryCondition.getDate("startDate");
        this.endDate = queryCondition.getDate("endDate");

    }
}
